home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / OTHER_LA / YERK__ / TOOLBOX_ / PICTURES < prev    next >
Text File  |  1990-08-14  |  2KB  |  55 lines

  1. \ 2.1.87    rfl version
  2. \ 4.28.88    rfl moveto needs work
  3. \ 8.31.88    rfl added theClip to this source
  4. \ 8.14.90    rfl moveto fixed
  5.  
  6. rect theClip    \ global clip rectangle
  7. -1000 dup 1000 dup put: theClip
  8.  
  9. : +pair { x1 y1 x2 y2 -- x1+y1 x2+y2 } x1 x2 + y1 y2 + ;
  10.  
  11. \ Interface object for QD picture support
  12. :CLASS Picture  <Super Object
  13.  
  14.     Handle    picHndl
  15.     Int        resID        \ resource ID if it is a resource
  16.     Rect    DestRect    \ destination rectangle for drawing
  17.  
  18.     \ ( l t r b -- )  Open a new pict with given frame
  19.     :M  OPEN:  Put: destrect  0 abs: destrect call OpenPicture
  20.         Put: picHndl  ;M
  21.  
  22.     \ ( -- )  terminate this picture definition
  23.     :M  CLOSE:  call ClosePicture   ;M
  24.  
  25.     \ ( resID -- )
  26.     :M INIT:  put:  resID  ;M
  27.  
  28.     \ load the picture from a resource file
  29.     :M  GETNEW:  0 int: resID  call GetPicture  put: picHndl
  30.         ptr: picHndl  2+ get: rect  put: destRect   ;M
  31.  
  32.     \ ( w h -- )  Set size in pixels of dest rect
  33.     :M  SIZE:   getTop:  destRect  +Pair  putBot: destRect ;M
  34.  
  35.     \ ( x y -- )  Move dest rect to given location
  36.     :M  GOTO:  { x y -- }   Size: destRect  x y putTop: DestRect
  37.         Size: self  ;M
  38.  
  39.     \ ( -- )  Draw the picture in destRect
  40.     :M  DRAW:  get: picHndl abs: destRect
  41.         call DrawPicture   ;M
  42.  
  43.     \ ( x y resID -- )  Combines the actions of init:, getNew:, goto: & draw:
  44.     :M  DISP:  init: self  getNew: self  goto: self  draw: self  ;M
  45.  
  46.     \ goto to location and draw self
  47.     :M  MOVETO: ( x y -- ) goto: self draw: self ;M
  48.  
  49.     \ ( -- )  dispose of picture heap
  50.     :M  KILL:  get: picHndl  call KillPicture   ;M
  51.  
  52. ;CLASS
  53.  
  54.  
  55.